from ..exts import db
from . import BaseModel


class Letter(BaseModel):
    __tablename__ = 'tb_letter'
    letter = db.Column(db.String(1), unique=True, comment='字母')


class City(BaseModel):
    __tablename__ = 'tb_city'
    city_id = db.Column(db.Integer, default=0, comment='城市ID号')
    parent_id = db.Column(db.Integer, default=0, comment='城市parentId字段')
    region_name = db.Column(db.String(16), comment='区域名')
    city_code = db.Column(db.Integer, default=0, comment='城市编码')
    pinyin = db.Column(db.String(64), comment='城市拼音')

    letter_id = db.Column(db.Integer, db.ForeignKey('tb_letter.id'))


class Movie(BaseModel):
    __tablename__ = "tb_movies"
    show_name = db.Column(db.String(64), comment='电影名')
    show_name_en = db.Column(db.String(128), comment='英文名')
    intro = db.Column(db.Text, comment='剧情介绍')
    director = db.Column(db.String(64), comment='导演')
    main_acts = db.Column(db.String(255), comment='主演')
    type = db.Column(db.String(64), comment='电影类型')
    country = db.Column(db.String(64), comment='哪国')
    language = db.Column(db.String(64), comment='语言')
    duration = db.Column(db.Integer, default=90, comment='时长')
    projection = db.Column(db.String(32), comment='电影放映技术')
    release = db.Column(db.DateTime, comment='开放日期')
    bgp = db.Column(db.String(256), comment='背景图')
    flag = db.Column(db.Boolean, default=False, comment='标志')
    is_delete = db.Column(db.Boolean, default=False, comment='逻辑删除')

    hall_movies = db.relationship('HallMovie', backref='Movie', lazy=True)
